package com.lyb.spzx.manager.controller;

import com.lyb.spzx.manager.service.FileUploadService;
import com.lyb.spzx.model.vo.common.Result;
import com.lyb.spzx.model.vo.common.ResultCodeEnum;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "上传文件接口")
@RestController
@RequestMapping("admin/system")
public class FileUploadController {

    @Autowired
    FileUploadService fileUploadService;

    @PostMapping("/fileUpload")
    public Result<String> fileUploadService(@RequestParam(value = "file") MultipartFile multipartFile){
        String fileName = fileUploadService.fileUpload(multipartFile);
        return Result.build(fileName , ResultCodeEnum.SUCCESS);
    }

}
